/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package iagente;
import java.util.Random;

public class Mapa {
  
    char[] map;
    public static Mapa mapa = null;
    Random randomGenerator;
    
    
  public Mapa(String x){
       randomGenerator = new Random();
       map = new char[Interfaz.tamaño]; 
       if ("aleatorio".equals(x)){
           for(int i = 0; i < map.length; i++){
                  if(i<Interfaz.x_fila || i>=map.length-Interfaz.x_fila){
                     map[i] = '#';
                  
                  }else{
                         for(int j=0; j<Interfaz.x_fila; j++ ){  
                               if(j == 0 || j == Interfaz.x_fila-1){
                                        map[i+j] = '#'; 
                                  }else{
                                        switch (randomGenerator.nextInt(4)){
                                            case 0: map[i+j] = ' ';break;
                                            case 1: map[i+j] = '#';break;
                                            case 2: map[i+j] = 'M';break;
                                            case 3: map[i+j] = 'B';break;
                                            case 4: map[i+j] = 'E';break;
                                        }
                                  }
                              }
                                i+= Interfaz.x_fila-1;
                        }   

          
            }
       
       }else {
                for(int i = 0; i < map.length; i++){
                    if(i<Interfaz.x_fila || i>=map.length-Interfaz.x_fila){
                          map[i] = '#';
                    }else{
                           for(int j=0; j<Interfaz.x_fila; j++ ){  
                                    if(j == 0 || j == Interfaz.x_fila-1){
                                        map[i+j] = '#'; 
                            }else{
                                     map[i+j] = ' ';
                                  }
                           }
                            i+= Interfaz.x_fila-1;
                    }   
                } 
          
            }
   
  }
    
  
  
    public void setMap(int index, char ch){
                 map[index] = ch;
    }
      
      
}
